home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_07_1985_Transactor_Publishing.d64
/
vector manager
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
3KB
|
146 lines
0 rem the transactor volume 6 issue 02 page 63
100 sys700 ;pal 64 asm
110 .opt oo
120 *=50000
130 ;vector link example
131 ;vector management system
132 ;sys 50000,50003,50006 or 50009
133 ;to activate or deactivate routines
134 ;(examples are irq-driven)
135 ;** see article for details **
140 irqvec =$0314
150 jmp connect ;connect rtn1
160 jmp p1dis ;disconnect rtn2
170 jmp p2con ;connect rtn2
180 jmp p2dis ;disconnect rtn2
190 ;
200 conflag .byt 0
210 con2flg .byt 0
220 ;
230 p1dis =*
240 jsr addcheck ;vector point to rtn"?
250 bne derr ;no, can't disc[145]nect
260 lda c[145]flag ;see [139] al[135]y set[171]up
270 beq p1e ;al[135]y disc[145]nected
280 sei ;ok, set [164] prev state
290 lda #0
300 sta c[145]flag ;clear c[145]nect flag
310 lda oldirq
320 sta irqvec
330 lda oldirq[170]1
340 sta irqvec[170]1
350 cli
360 p1e rts
370 ;
380 c[145]nect [178][172]
390 lda c[145]flag ;al[135]y c[145]nected"?
400 bne cerr ;yes, error
410 lda #255
420 sta conflag ;set connect flag
430 lda irqvec ;save old vector
440 sta oldirq
450 lda irqvec+1
460 sta oldirq+1
470 sei ;now connect new rtn
480 lda #<displin
490 sta irqvec
500 lda #>displin
510 sta irqvec+1
520 cli
530 rts
540 ;
550 oldirq .wor *-*
560 ;
570 derr =*
580 lda #<dmsg: ldy #>dmsg
590 jsr $ab1e ;prt string
600 rts
610 dmsg .asc "** can't disconnect **"
620 .byte 0
630 ;
640 cerr =*
650 lda #<cmsg: ldy #>cmsg
660 jsr $ab1e ;prt string
670 rts
680 cmsg .asc "** can't connect: already connected"
690 .byte 13,0
700 ;
710 addcheck =*
720 ;set z if irvec<>displin
730 lda irqvec
740 cmp #<displin
750 bne cout
760 lda irqvec+1
770 cmp #>displin
780 cout rts
790 ;
800 ;
810 displin =*
820 ldx #39
830 d1 =*
840 lda msg,x
850 sta $0400,x
860 lda #1
870 sta $d800,x
880 dex
890 bpl d1
900 jmp (oldirq)
910 ;
920 msg .asc "*** zamsoft operating system v 1.0 *** "
930 ;
940 p2dis =*
950 jsr p2chk ;points to rtn2"?
960 beq [172][170]5:jmp derr;no, can't disc[145]nect
970 lda c[145]2flg
980 beq p2e ;al[135]y disc[145]nected
990 lda #0
1000 sta c[145]2flg ;clear c[145]nect flag
1010 sei
1020 lda oldirq2
1030 sta irqvec
1040 lda oldirq2[170]1
1050 sta irqvec[170]1
1060 cli
1070 p2e rts
1080 ;
1090 p2c[145] [178][172]
1100 lda c[145]2flg
1110 beq [172][170]5:jmp cerr
1120 lda #255
1130 sta c[145]2flg ;set c[145]nect flag
1140 lda irqvec
1150 sta oldirq2
1160 lda irqvec[170]1
1170 sta oldirq2[170]1
1180 sei
1190 lda #[179]prog2
1200 sta irqvec
1210 lda #[177]prog2
1220 sta irqvec[170]1
1230 cli
1240 rts
1250 ;
1260 oldirq2 .w[176] [172][171][172]
1270 ;
1280 p2chk [178][172]
1290 lda irqvec
1300 cmp #[179]prog2
1310 bne pout
1320 lda irqvec[170]1
1330 cmp #[177]prog2
1340 pout [178][172]
1350 rts
1360 ;
1370 prog2 [178][172]
1380 lda 197
1390 cmp lkey
1400 beq p2out
1410 cmp #6
1420 bne p2out
1430 inc $d020
1440 p2out [178][172]
1450 lda 197: sta lkey
1460 jmp (oldirq2)
1470 ;
1480 lkey .byt [172][171][172]